UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QRbobt6Fw1CSn4LHVfr3hzeSgBxXtYhZGYxNw1q49Rw=' 
WHERE 
  key_id = '0e23f25e601e55e7e9a27c78015d4fdef5e767dc551255106fc48fde327b525c' 
  AND (
    token = 'QRbobt6Fw1CSn4LHVfr3hzeSgBxXtYhZGYxNw1q49Rw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041