UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qip8Qx6g9v/wZToz04DeZE3FacNcdOx6mv72jjzDW28='
WHERE
key_id = '42751849349d29f7963ca70ea5c996b3cc954bdd8e640701a1df82e0542b8d0a'
AND (
token = 'qip8Qx6g9v/wZToz04DeZE3FacNcdOx6mv72jjzDW28='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)