UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'frjdKJmetq3hkAiT/uofCRN2bC3f77jltFTPkTlphx0=' 
WHERE 
  key_id = '9605c10ecb38d20cdf1997c139651b154dd942cb7cdd193d8b69817e45348d6f' 
  AND (
    token = 'frjdKJmetq3hkAiT/uofCRN2bC3f77jltFTPkTlphx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051