UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hQfPFHamTS/iqpvSr5xPqEKCwFuOOaGewPK4le2kCP8=' 
WHERE 
  key_id = 'fedf4a542c9b410a8990997418c663b7f92875a7db23c1c34d31b38d934ab927' 
  AND (
    token = 'hQfPFHamTS/iqpvSr5xPqEKCwFuOOaGewPK4le2kCP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024