UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3ioEA9c1lJ0q86grxm+JFEML4fnc4+h+Hj5yaLLyx/I='
WHERE
key_id = '25312c4c8b07eab1f7a034b8cda2dab9e68407a63f11c4b7995c1ccb627922db'
AND (
token = '3ioEA9c1lJ0q86grxm+JFEML4fnc4+h+Hj5yaLLyx/I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)