UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w86VC5VFnCDJxGbqVnf8LMtbC8q5Aj/lrecbxmAJ/GI=' 
WHERE 
  key_id = 'c715c99f2735c88e760b8267e20196121c0cae6ecadf9177de7af0e37d8cee22' 
  AND (
    token = 'w86VC5VFnCDJxGbqVnf8LMtbC8q5Aj/lrecbxmAJ/GI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032