UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ACZRvxil8TyOU+k66l0JWbgF1d6CO9fYHZ8m0DNQXxY=' 
WHERE 
  key_id = '52f8d93f1224e37fa01f958c633540d78e4801eec6a6fb646a9a78b6ed6dcf61' 
  AND (
    token = 'ACZRvxil8TyOU+k66l0JWbgF1d6CO9fYHZ8m0DNQXxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020