UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XAuXieZ5TLAEELz0+Z+IOQuD0VI0HTJqzuGd4CdYfHs='
WHERE
key_id = '140da33cb5951eb13dc43b00e0eafdc41753ace18a92cfd28bd543bc35dca30b'
AND (
token = 'XAuXieZ5TLAEELz0+Z+IOQuD0VI0HTJqzuGd4CdYfHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)