UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jKu2IA2o8vjn9pgK5CKdi+kSwdL8B+j4x4FsEVn0OVE=' 
WHERE 
  key_id = '09f3fca4586fb06053397a2956b664cf529825da4ae996e61bf3b18bb84a046c' 
  AND (
    token = 'jKu2IA2o8vjn9pgK5CKdi+kSwdL8B+j4x4FsEVn0OVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028