UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7aTL6GUxMObUjXcW/R+C+LXX1eNI1gES7luckiUlf6k=' 
WHERE 
  key_id = '472c3dd42026cbad08db135715ec0621045411b86a31cb84273b7646a90a3b1d' 
  AND (
    token = '7aTL6GUxMObUjXcW/R+C+LXX1eNI1gES7luckiUlf6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032