UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tT4c0OUq3p+Lv/kvfbyWFUCQcHiD8Y603ElXndOnhm4=' 
WHERE 
  key_id = '3d63a7e6987f8c24985e6c569492b39a8cff848450814583730dc1eddd544926' 
  AND (
    token = 'tT4c0OUq3p+Lv/kvfbyWFUCQcHiD8Y603ElXndOnhm4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052