UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nqyBPWG7fPxNuZ8tD7TLjCJfJr7uOw2KOXso2aLlQTA='
WHERE
key_id = '66a55ee027c4214bde0a492f773bd74ed6e53b2873e0307b93987dbffe0a5cc8'
AND (
token = 'nqyBPWG7fPxNuZ8tD7TLjCJfJr7uOw2KOXso2aLlQTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)