UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YpeShZHS+bsDHlFTVonFzmA45MoDUkx53IL0ZmIbDBM=' 
WHERE 
  key_id = '5ac9b91cbf913bebf8e03b1e719d019df872b906b330893fac451cd2945f7a91' 
  AND (
    token = 'YpeShZHS+bsDHlFTVonFzmA45MoDUkx53IL0ZmIbDBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042