UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iAA2VXOvB1X9AK75D2OdaAl7rrX5lL8FcqnrcWwrepM='
WHERE
key_id = '2a2c0eb0d121c66ddc0863bd49163ab54cac23713a1aab737f7361ab38599b3a'
AND (
token = 'iAA2VXOvB1X9AK75D2OdaAl7rrX5lL8FcqnrcWwrepM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)