UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qX9I6UQj8Yw9P8f0TkTiWSJ/Mn13C72TYWItir+ljg0=' 
WHERE 
  key_id = 'cd14a9a4e8081178b0a9f90c783acad652951fd7928eefb93ab9a2fbe10263c0' 
  AND (
    token = 'qX9I6UQj8Yw9P8f0TkTiWSJ/Mn13C72TYWItir+ljg0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033