UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gSna3LlJTtyht0ewcYKpcsMp/iPYmaHO7kSBsnj1xAw='
WHERE
key_id = 'fb8b7171fff05eecbb95650c3ba685c7f387f80feca2de367f3fcaf401ed7e02'
AND (
token = 'gSna3LlJTtyht0ewcYKpcsMp/iPYmaHO7kSBsnj1xAw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)