UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XvZzWj0oQGSuIwRrGtRtZfgVQYQZHZ58j6vRsWGDHAo=' 
WHERE 
  key_id = '109d898d9dde61918b6a24e36cf18ce134957b44649d546fd808a28c7f2f0836' 
  AND (
    token = 'XvZzWj0oQGSuIwRrGtRtZfgVQYQZHZ58j6vRsWGDHAo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027