UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iC3EFCYi+ct7Wp5AdF2+2SyGrt+uxt4KS5D83ZOS+hE=' 
WHERE 
  key_id = 'd3e9e4d74bf4947473bb8a375a54ec19017ecc13233cb519d1d081505eb688a8' 
  AND (
    token = 'iC3EFCYi+ct7Wp5AdF2+2SyGrt+uxt4KS5D83ZOS+hE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020