UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NeQBuRQrTPl9yZNl2mbYmEmpbg5p2M/pL43xU167bDw='
WHERE
key_id = 'f09510ce9f999ebbb0be33f0247cdcfdc75114711ee755aa5389b1c8675505f9'
AND (
token = 'NeQBuRQrTPl9yZNl2mbYmEmpbg5p2M/pL43xU167bDw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)