UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dd3D3JehLw1xWO/97V7e6JGPIWlppOhhiW43EYeVObk='
WHERE
key_id = '20f56f678fadc64e89072064c40eeee52ffc65122f359e62ae586ad61891c4f5'
AND (
token = 'dd3D3JehLw1xWO/97V7e6JGPIWlppOhhiW43EYeVObk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)