UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uLUsVCrHBH1JG9gWlo548kYhAMPtN6zYewzCqxUxj8M='
WHERE
key_id = '7598b82855cbfe81a640e6ff86c6a700eb6c68e1f3d8c8f13fe55f78dc59f70f'
AND (
token = 'uLUsVCrHBH1JG9gWlo548kYhAMPtN6zYewzCqxUxj8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)