UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YL6L5bijB8tgooi4odO3JP4m7Zpw5RuYppfHcZi9KXs=' 
WHERE 
  key_id = '76f8189bf755ec24010ae186df376b4cae2111f33187a02b98ea770d6b3fe247' 
  AND (
    token = 'YL6L5bijB8tgooi4odO3JP4m7Zpw5RuYppfHcZi9KXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038