UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WcWEr9G2JEIrCV2ho/FJwElzfvshrZSpALZXH0UgUog='
WHERE
key_id = '7e34209cd34180086c050b4a95426f943aaf7076af1a96bf296c96548658abbb'
AND (
token = 'WcWEr9G2JEIrCV2ho/FJwElzfvshrZSpALZXH0UgUog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)