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

Query time 0.00039