UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x8yiQf0BW0ofCjvWP4u8V7Sog1OCiF68aQylJoU6bdg=' 
WHERE 
  key_id = '9c7d0027f78b8b7771e09403da08f5c21744e74433206e29703de2c39038f0b9' 
  AND (
    token = 'x8yiQf0BW0ofCjvWP4u8V7Sog1OCiF68aQylJoU6bdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016