UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'staUW3vuruuVP6TGjcZ57n5XU2UCx2ghQv1AWTRzv08='
WHERE
key_id = '3a6413c7c8fb153af16d2e7c90b4e9818700c20a7b1c4ed765f7d1667f7947fe'
AND (
token = 'staUW3vuruuVP6TGjcZ57n5XU2UCx2ghQv1AWTRzv08='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)