UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hR47okpUFtatDfxl+dQi6SPi3yz/dqJj361qfzToOtM='
WHERE
key_id = '59e359e1d1049b244b2660bbd151bd422bc7bb77378f66c95ecd03d54f18ef52'
AND (
token = 'hR47okpUFtatDfxl+dQi6SPi3yz/dqJj361qfzToOtM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)