UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '16FPbuA0vV3c8ievSGZD++Q3mIKpVqBsnsC79UZb1h0='
WHERE
key_id = '9bd3a4e9cbf6a6a3de8d986f5ed0bc435fe5d8cb0ba465c95e4cb035df4c012a'
AND (
token = '16FPbuA0vV3c8ievSGZD++Q3mIKpVqBsnsC79UZb1h0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)