UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0yCKsec0yxSghDtGgSaaZz2X+gMCZWgCg9rYUHxHOw0='
WHERE
key_id = 'c78880386ced534832436c2076712ac08cf4c40544ace1a3cf104ab60167da30'
AND (
token = '0yCKsec0yxSghDtGgSaaZz2X+gMCZWgCg9rYUHxHOw0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)