UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p6BmLuFDa45H/UrwV8qeKupi0HCx4nbLApStUbJtyc4='
WHERE
key_id = 'e1992168bd9baaa45e1ef57923eaf8b43172cb51f8389a2c1f1b3631e8bd9f4f'
AND (
token = 'p6BmLuFDa45H/UrwV8qeKupi0HCx4nbLApStUbJtyc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)