UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p3OKvXg0DeJRp6bdrSfZmfrq5thUPYO2A15Dv4HMYQc='
WHERE
key_id = 'd9a68b029a0a8fa69355ede51ab5d16646ae6887f85e8665907868926a943b32'
AND (
token = 'p3OKvXg0DeJRp6bdrSfZmfrq5thUPYO2A15Dv4HMYQc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)