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