UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ba2Ky7e0kRQApdQLw4NeoQhdVxi5z5ScRgLYZXcVhec='
WHERE
key_id = '8cd5940859d438948a0c05495527e3266de07230d2ef15e57129fb39fffa2aa6'
AND (
token = 'Ba2Ky7e0kRQApdQLw4NeoQhdVxi5z5ScRgLYZXcVhec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)